package com.example.liteflow.bol;

import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeBooleanComponent;
import com.yomahub.liteflow.slot.Slot;
import lombok.extern.slf4j.Slf4j;

/**
 * @author chen.an
 * @date 2024-08-20 20:49
 */
@Slf4j
@LiteflowComponent(id = "If1", name = "判断（age>18）")
public class IfNode1 extends NodeBooleanComponent {
    @Override
    public boolean processBoolean() throws Exception {
        Slot slot = this.getSlot();
        int age = slot.getRequestData();
        log.info("If1 节点组件【{}】-BooleanNode,获取数据：{}", Thread.currentThread().threadId(), age);
        //注意：需要进行传值传递
        slot.setRequestData(age);
        return age > 18;
    }
}
